<template>
  <div class="home-container">
    <!-- 导航栏 -->
    <nav class="navbar">
      <div class="nav-content">
        <div class="nav-brand">
          <h1>舆情智能助手</h1>
        </div>
        <div class="nav-menu">
          <router-link to="/" class="nav-link active">首页</router-link>
          <router-link to="/chat" class="nav-link">对话</router-link>
          <router-link to="/search" class="nav-link">检索</router-link>
        </div>
      </div>
    </nav>

    <!-- 主要内容 -->
    <main class="main-content">
      <!-- 英雄区域 -->
      <section class="hero-section">
        <div class="hero-content">
          <div class="hero-badge">AI 驱动</div>
          <h2 class="hero-title">舆情智能助手</h2>
          <p class="hero-subtitle">简洁高效的舆情报告生成和舆情信息检索平台，基于先进AI技术，为您提供智能化的舆情分析解决方案。</p>
          <div class="hero-actions">
            <router-link to="/chat" class="btn btn-primary">
              <span>开始对话</span>
              <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
                <path d="M6 12L10 8L6 4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
              </svg>
            </router-link>
            <router-link to="/search" class="btn btn-secondary">
              <span>信息检索</span>
              <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
                <circle cx="7" cy="7" r="6" stroke="currentColor" stroke-width="2"/>
                <path d="M15 15L11 11" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
              </svg>
            </router-link>
          </div>
        </div>
        <div class="hero-visual">
          <div class="code-block animate-code">
            <div class="code-header">
              <div class="code-dots">
                <span></span>
                <span></span>
                <span></span>
              </div>
              <span class="code-title"></span>
            </div>
            <div class="code-content">
              <pre><code class="typewriter-code"># 舆情分析报告

## 事件概述
某品牌产品发布引发热议

## 情感分析
- 正面: 65%
- 负面: 20%
- 中性: 15%

## 热点话题
1. 产品创新 (8.5/10)
2. 价格合理性 (7.2/10)

## 建议措施
- 加强正面宣传
- 及时回应反馈</code></pre>
            </div>
          </div>
        </div>
      </section>

      <!-- 功能特性 -->
      <section class="features-section">
        <div class="section-header">
          <h3>核心功能</h3>
          <p>强大的AI技术驱动，为您提供全方位的舆情分析服务</p>
        </div>
        <div class="features-grid">
          <div class="feature-card">
            <div class="feature-icon">
              <svg width="24" height="24" viewBox="0 0 24 24" fill="none">
                <path d="M9 12L11 14L15 10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                <path d="M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z" stroke="currentColor" stroke-width="2"/>
              </svg>
            </div>
            <h4>智能报告生成</h4>
            <p>基于先进AI技术，自动生成专业、准确的舆情分析报告</p>
          </div>
          
          <div class="feature-card">
            <div class="feature-icon">
              <svg width="24" height="24" viewBox="0 0 24 24" fill="none">
                <circle cx="11" cy="11" r="8" stroke="currentColor" stroke-width="2"/>
                <path d="M21 21L16.65 16.65" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
              </svg>
            </div>
            <h4>高效信息检索</h4>
            <p>快速、精准的信息搜索和检索功能，支持多种数据源</p>
          </div>
        </div>
      </section>



      <!-- 快速开始 -->
      <section class="quick-start-section">
        <div class="section-header">
          <h3>快速开始</h3>
          <p>简单三步，开始您的舆情分析之旅</p>
        </div>
        <div class="quick-start-grid">
          <div class="quick-start-card">
            <div class="step-number">01</div>
            <h4>选择功能</h4>
            <p>根据您的需求选择对话或检索功能，系统将为您提供相应的服务</p>
          </div>
          <div class="quick-start-card">
            <div class="step-number">02</div>
            <h4>输入内容</h4>
            <p>输入您的问题或搜索关键词，支持文本、文件等多种输入方式</p>
          </div>
          <div class="quick-start-card">
            <div class="step-number">03</div>
            <h4>获取结果</h4>
            <p>AI助手将为您提供智能化的分析和回答，生成专业的舆情报告</p>
          </div>
        </div>
      </section>
      
      <!-- 临时调试按钮 -->
      <section class="debug-section" style="margin: 2rem 0; text-align: center;">
        <h4>调试工具</h4>
        <div class="debug-buttons" style="margin-top: 1rem;">
          <button @click="setLoggedIn" style="margin: 0 0.5rem; padding: 0.5rem 1rem; background: #000; color: white; border: none; border-radius: 4px; cursor: pointer;">设置为已登录</button>
          <button @click="setLoggedOut" style="margin: 0 0.5rem; padding: 0.5rem 1rem; background: #666; color: white; border: none; border-radius: 4px; cursor: pointer;">设置为未登录</button>
          <button @click="showUserInfo" style="margin: 0 0.5rem; padding: 0.5rem 1rem; background: #333; color: white; border: none; border-radius: 4px; cursor: pointer;">查看用户信息</button>
        </div>
      </section>
    </main>

    <!-- 页脚 -->
    <footer class="footer">
      <div class="footer-content">
        <p>&copy; 2024 舆情智能助手. 保留所有权利.</p>
      </div>
    </footer>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'

// 调试函数
const setLoggedIn = () => {
  const userInfo = {
    isLoggedIn: true,
    username: 'admin',
    nickname: '管理员',
    avatar: 'A'
  }
  localStorage.setItem('userInfo', JSON.stringify(userInfo))
  alert('已设置为登录状态')
}

const setLoggedOut = () => {
  localStorage.removeItem('userInfo')
  alert('已设置为未登录状态')
}

const showUserInfo = () => {
  const savedUserInfo = localStorage.getItem('userInfo')
  if (savedUserInfo) {
    const userInfo = JSON.parse(savedUserInfo)
    alert(`当前用户信息：\n${JSON.stringify(userInfo, null, 2)}`)
  } else {
    alert('当前未登录')
  }
}
</script>

<style scoped>
.home-container {
  background: #ffffff;
  background-image: 
    linear-gradient(rgba(0, 0, 0, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.08) 1px, transparent 1px);
  background-size: 30px 30px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #000000;
  position: relative;
  overflow-x: hidden;
  width: 100%;
}

/* 背景装饰光球 */
.home-container::before,
.home-container::after {
  content: '';
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  animation: fadeInFloat 2s ease-out forwards;
}

.home-container::before {
  top: 75%;
  left: -300px;
  transform: translateY(-50%);
  background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0.1) 20%, transparent 50%);
  animation: fadeInFloatLeft 2s ease-out forwards;
}

.home-container::after {
  top: -200px;
  right: -200px;
  background: radial-gradient(circle, rgba(255, 193, 7, 0.25) 0%, rgba(255, 193, 7, 0.1) 20%, transparent 50%);
  animation: fadeInFloat 2s ease-out forwards, float2 10s ease-in-out infinite reverse 2s;
}

@keyframes fadeInFloatLeft {
  0% {
    opacity: 0;
    transform: translateY(-50%) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

@keyframes fadeInFloat {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}



@keyframes float2 {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-30px, 30px) scale(1.1);
  }
}

/* 导航栏 */
.navbar {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(5px) saturate(200%);
  -webkit-backdrop-filter: blur(5px) saturate(200%);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1rem 0;
  width: 100%;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand h1 {
  margin: 0;
  color: #000000;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.nav-menu {
  display: flex;
  gap: 2rem;
}

.nav-link {
  color: #666666;
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.nav-link:hover,
.nav-link.active {
  color: #000000;
  background: rgba(0, 0, 0, 0.05);
}

/* 主要内容 */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  padding-top: 80px;
  position: relative;
  z-index: 1;
  width: 100%;
  box-sizing: border-box;
}

/* 英雄区域 */
.hero-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  padding: 6rem 0 4rem;
  position: relative;
}

.hero-content {
  max-width: 500px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #000000;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  margin: 0 0 1.5rem 0;
  line-height: 1.1;
  color: #000000;
  letter-spacing: -0.025em;
}

.hero-subtitle {
  font-size: 1.125rem;
  margin: 0 0 2.5rem 0;
  color: #666666;
  line-height: 1.6;
  font-weight: 400;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  letter-spacing: 0.025em;
}

.btn-primary {
  background: #000000;
  color: #ffffff;
}

.btn-primary:hover {
  background: #333333;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.9);
  color: #000000;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(0, 0, 0, 0.2);
}

/* 代码块样式 */
.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.code-block {
  background: #f8f9fa;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.code-header {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.code-dots {
  display: flex;
  gap: 0.5rem;
  margin-right: 1rem;
}

.code-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
}

.code-title {
  font-size: 0.875rem;
  color: #666666;
  font-weight: 500;
}

.code-content {
  padding: 1.5rem;
}

/* 代码块动画 */
@keyframes typewriter {
  0% {
    width: 0;
  }
  100% {
    width: 100%;
  }
}

@keyframes blink {
  0%, 50% {
    border-color: transparent;
  }
  51%, 100% {
    border-color: #000000;
  }
}

.animate-code {
  animation: fadeIn 0.5s ease-out 0.3s both;
}

.typewriter-code {
  display: block;
  overflow: hidden;
  white-space: pre;
  border-right: 2px solid #000000;
  animation: typewriter 3s steps(40) 0.8s both, blink 1s infinite;
  max-width: 100%;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.code-content pre {
  margin: 0;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #000000;
}

.code-content code {
  background: none;
  padding: 0;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* 功能特性 */
.features-section {
  padding: 6rem 0;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.section-header {
  text-align: center;
  margin-bottom: 4rem;
}

.section-header h3 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #000000;
  margin: 0 0 1rem 0;
  letter-spacing: -0.025em;
}

.section-header p {
  font-size: 1.125rem;
  color: #666666;
  margin: 0;
  max-width: 600px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.feature-card {
  padding: 2rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: #ffffff;
  transition: all 0.2s ease;
}

.feature-card:hover {
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feature-icon {
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  color: #000000;
}

.feature-card h4 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #000000;
  margin: 0 0 1rem 0;
}

.feature-card p {
  color: #666666;
  line-height: 1.6;
  margin: 0;
  font-size: 0.875rem;
}



/* 快速开始 */
.quick-start-section {
  padding: 6rem 0;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  width: 100%;
  box-sizing: border-box;
}

.quick-start-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  box-sizing: border-box;
}

.quick-start-card {
  padding: 2rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: #ffffff;
  transition: all 0.2s ease;
}

.quick-start-card:hover {
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.step-number {
  width: 48px;
  height: 48px;
  background: #000000;
  color: #ffffff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.quick-start-card h4 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #000000;
  margin: 0 0 1rem 0;
}

.quick-start-card p {
  color: #666666;
  line-height: 1.6;
  margin: 0;
  font-size: 0.875rem;
}

/* 页脚 */
.footer {
  background: rgba(0, 0, 0, 0.02);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding: 2rem 0;
  width: 100%;
  box-sizing: border-box;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  text-align: center;
  box-sizing: border-box;
}

.footer-content p {
  margin: 0;
  color: #666666;
  font-size: 0.875rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .hero-section {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .nav-content {
    flex-direction: column;
    gap: 1rem;
  }
  
  .nav-menu {
    gap: 1rem;
  }
  
  .hero-actions {
    justify-content: center;
  }
  
  .features-grid,
  .quick-start-grid {
    grid-template-columns: 1fr;
  }
  
  .section-header h3 {
    font-size: 2rem;
  }
}
</style> 